package com.cc.controller

import com.cc.common.model.Results
import com.cc.service.ScriptService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * 首页统计API
 *
 * @author aa
 * @since 2024/4/22
 * @version 1.0
 */
@RestController
@RequestMapping("/dataCollection/monitor")
class HomeController(
    private val scriptService: ScriptService,
) {

    /**
     * 首页监控任务统计
     *
     * @return [Result]
     */
    @GetMapping("/taskCount")
    fun taskCount(): Results<Map<String, Int>> = Results.Ok(scriptService.taskCount())


    /**
     * 首页监控任务统计
     *
     * @return [Result]
     */
    @PostMapping("/runStatus")
    fun runStatus() = Results.Ok(scriptService.runStatus())


}